﻿using Domain.Entitys;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore.Configers
{
    public class UserConfiger : IEntityTypeConfiguration<User>
    {
        /// <summary>
        /// 用户表
        /// </summary>
        /// <param name="builder"></param>
        public void Configure(EntityTypeBuilder<User> builder)
        {
            builder.ToTable(nameof(User));
            builder.HasKey(u => u.UId);//配置主键
            builder.Property(u => u.UName).IsRequired(false).HasMaxLength(50);
            builder.Property(u => u.UTrueName).IsRequired(false).HasMaxLength(50);
            builder.Property(u => u.UPassWord).IsRequired(false).HasMaxLength(50);
        }
    }
}
